﻿ 

using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Reflection;
using zkdao.Application;
using zkdao.Domain;
using zkdao.Enum;
using sharp_net;
using log4net;

namespace zkdao.Wcf {
	public class TagService : ITagService {
		private readonly ITagService tagService = IocLocator.Instance.GetImple<ITagService>();
				public TagData Get(Guid ID) {
			try {
				return tagService.Get(ID);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public TagData GetByName(String name) {
			try {
				return tagService.GetByName(name);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public IList<TagData> GetList() {
			try {
				return tagService.GetList();
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public IList<TagData> GetListByGroup(eTagGroup group) {
			try {
				return tagService.GetListByGroup(group);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public TagData Creat(TagData dataObject) {
			try {
				return tagService.Creat(dataObject);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public void Update(TagData dataObject) {
			try {
				 tagService.Update(dataObject);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
			}
}